<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="author" content="Guillaume Laborde - Guillaume Lameyre" />
<link rel="stylesheet" media="screen" type="text/css" title="style" href="css/style.css" />
<title>ContactBook</title>
</head>

<body>

	<c:set var="account" value="${sessionScope.account}"></c:set>
	<c:set var="nbGroups" value="${requestScope.nbGroups}"></c:set>
	<c:set var="nbContacts" value="${requestScope.nbContacts}"></c:set>
	
	<c:if test="${empty account}">
		<c:redirect url="Index" />
	</c:if>
	
	<div id="mainframe">
		<c:import url="include/privateBanner.html" />
		<h1>Mon compte</h1>
		<div id="content">
		
			<jsp:useBean id="account" class="contactbook.model.Account" scope="page"/>
			<fieldset>
				<legend><img src="images/account.png" alt="" /> <jsp:getProperty name="account" property="login" /></legend>
				<div class="right">
					<form action="UpdateAccount" method="POST" class="inline">
						<input type="image" src="images/edit.png" alt="Modifier" title="Modifier le compte" />
					</form>
					<form action="DeleteAccount" method="POST" class="inline">
			            <input type="image" src="images/delete.png" alt="Supprimer" title="Supprimer le compte" />
					</form>
				</div>
				
				<p><img src="images/arrow.png" alt="" title="" />Votre compte existe depuis le <fmt:formatDate pattern="dd/MM/yyyy" value="${account.dateCreated}"/>.</p>
				
				<p>
					<c:if test="${nbGroups == '0'}">
						<img src="images/arrow.png" alt="" title="" />Vous n'avez créé aucun groupe.
					</c:if>
					<c:if test="${nbGroups != '0'}">
						<img src="images/arrow.png" alt="" title="" />Vous avez créé <c:out value="${nbGroups}" /> groupe<c:if test="${nbGroups != '1'}">s</c:if>.
					</c:if>
				</p>
				<p>
					<c:if test="${nbContacts == '0'}">
						<img src="images/arrow.png" alt="" title="" />Il n'y a aucun contact pour le moment dans votre ContactBook.
					</c:if>
					<c:if test="${nbContacts != '0'}">
						<img src="images/arrow.png" alt="" title="" />Il y a actuellement <c:out value="${nbContacts}" /> contact<c:if test="${nbContacts != '1'}">s</c:if> dans votre ContactBook.
					</c:if>
				</p>
					
			</fieldset>
		</div>
		<c:import url="include/bottom.html" />
	</div>
	
</body>
</html>